﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace CommonLib
{
	public class GameStateController
	{
		GameStateBase currentState;
		public GameStateBase CurrentState => currentState;
		public GameStateController(GameStateBase initState)
		{
			initState.EnterState();
			currentState = initState;
		}
		public void ChangeState(IGameState state)
		{
			currentState = state as GameStateBase;
			currentState.EnterState();
		}
		static public GameStateBase GetGameState(GameState state)
		{
			switch (state)
			{
				case GameState.Start:
					return new GameStateStartUp();
				case GameState.GamePlay:
					return new GameStateGamePlay();
				case GameState.Lobby:
					return new GameStateLobby();
				case GameState.Login:
					return new GameStateLogin();
				default:
					return null;
					
			}
		}
	}

	//描述当前的游戏状态
	public enum GameState
	{
		Start = 0,
		Login = 1,
		Lobby = 2,
		GamePlay = 3,
	}
}